package com.niodata.dp.monitor.components.task.dao;

import com.niodata.dp.monitor.sharelib.entity.task.TaskAlertMsg;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;

/**
 * Created by ndp on 17-7-10.
 */
@Mapper
public interface TaskAlertMsgMapper {

  @Insert("insert into TASK_ALERT_MSG (STATUS,EXEC_ID,TASK_ID,TASK_NAME,FLOW_NAME,MESSAGE,"
        + "START_TIME,REAL_START_TIME,OWNER_TYPE,OWNER_ID,CREATOR)"
        + " values (#{msgModel.status},#{msgModel.execId},"
        + "#{msgModel.taskId},#{msgModel.taskName},#{msgModel.flowName},#{msgModel.message},"
        + "#{msgModel.startTime},#{msgModel.realStartTime},"
        + "#{msgModel.ownerType},#{msgModel.ownerId},#{msgModel.creator})")
  public void insert(@Param("msgModel") TaskAlertMsg msgModel);

  @ResultMap("taskAlertMsgResultMap")
  public List<TaskAlertMsg> getTaskAlertMsgsByOwner(@Param("userId") long ownerId,
        @Param("ids") List<Long> ids, @Param("offset") int offset,
        @Param("count") int count, @Param("taskId") String taskId, @Param("status") String status);
}
